import Vue from 'vue'
import VueRouter from 'vue-router'
import BookManage from "../views/BookManage";
import PageThree from "../views/PageThree";
import PageFour from "../views/PageFour";
import AddBook from "../views/AddBook";
import Index from "../views/Index";
import BookUpdate from "../views/BookUpdate";

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: '图书管理',
    component: Index,
    // 当进入到 / 之后默认重定向到 pageOne
    redirect: '/bookManage',
    children: [
      {
        path: '/bookManage',
        name: '查询图书',
        component: BookManage,
        show: true
      },
      {
        path: '/addBook',
        name: '添加图书',
        component: AddBook,
        show: true
      },
      {
        path: '/bookUpdate',
        component: BookUpdate,
        show: false
      }
    ]
  },
  {
    path: '/navigation',
    name: '导航二',
    component: Index,
    children: [
      {
        path: '/pageThree',
        name: '页面3',
        component: PageThree,
        show: true
      },
      {
        path: '/pageFour',
        name: '页面4',
        component: PageFour,
        show: true
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
